<template>
  <router-view></router-view>
</template>
<script setup>
import { onBeforeMount, provide, readonly, onMounted } from "vue";
import toast from "@/libs/message/toast.js";
import { useRoleStore } from "./store/role";
import router from "@/route/index.js";
provide("toast", readonly(toast));
const store = useRoleStore();
onBeforeMount(() => {
  store.handleRefresh();
  const backup = {};
  const keepKeys = ['ZAYY_VISION', 'SAVE_TOKEN', 'SAVE_USER_ACCOUNT', 'SAVE_USER_INFO'];
  keepKeys.forEach(key => {
    const value = localStorage.getItem(key);
    if (value) {
      backup[key] = value;
    }
  });
  localStorage.clear();
  Object.keys(backup).forEach(key => {
    localStorage.setItem(key, backup[key]);
  });
  // getVersion().then(res => {
  //   console.log("版本号：" + res)
  //   let vision = res
  //   let v = localStorage.getItem("ZAYY_VISION")
  //   if (vision != v) {
  //     localStorage.setItem("ZAYY_VISION", vision)
  //     setTimeout(() => {
  //       location.reload()
  //     }, 1000)
  //   }
  // })
});
// onMounted(()=>{
//   ZWJSBridge.getUiStyle().then(res => {
//     this.$store.dispatch("setUiStyle", res.uiStyle);
//   });
// })
</script>
<style lang="less" scoped></style>
